import axios from "../../../utils/axios";

// 获取新闻分类列表
export const getNewsCategoryList = (params: any) => {
    return axios({
        method: 'get',
        url: '/prod-api/press/category/list',
        params
    })
}

// 获取新闻列表
export const getNewsList = (params: any) => {
    return axios({
        method: 'get',
        url: '/prod-api/press/press/list',
        params
    })
}

// 获取新闻详情
export const getNewsDetail = (id: any) => {
    return axios({
        method: 'get',
        url: `/prod-api/press/press/${id}`
    })
}

// 新闻点赞
export const newsLike = (id: any) => {
    return axios({
        method: 'put',
        url: `/prod-api/press/press/like/${id}`,
        headers: {
            "Authorization": window.localStorage.getItem("token")
        }
    })
}

// 获取评论列表
export const getCommentsList = (params: any) => {
    return axios({
        method: 'get',
        url: '/prod-api/press/comments/list',
        params
    })
}

// 评论点赞
export const commentLike = (id: any) => {
    return axios({
        method: 'put',
        url: `/prod-api/press/pressComment/like/${id}`,
        headers: {
            "Authorization": window.localStorage.getItem("token")
        }
    })
}

// 发表新闻评论
export const pressComment = (data: any) => {
    return axios({
        method: 'post',
        url: '/prod-api/press/pressComment',
        data,
        headers: {
            "Authorization": window.localStorage.getItem("token")
        }
    })
}